﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Affix.aspx.cs" StylesheetTheme="CielThemes"
    Inherits="ZX.WebApp.Crm.BasePages.Affix" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
  
    <script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>

    <style type="text/css">

        body
        {
            font-family: 宋体, Arial, Helvetica, sans-serif;
            font-size: 12px;
            color: #333333;
            background-color: #FFFFFF;
            background: #ececec;

        }
        select
        {
            width: 99%;
        }
        td
        {
            border: 1px solid #CCCCCC;
        }
        .textarea
        {
            width: 96%;
            height: 25px;
        }
    </style>
    <script type="text/javascript" language="javascript">
        //是否选中记录、删除确认。
        function Selected(statue) {
            if (statue != "3") {
                if (!confirm('是否删除所选数据?'))
                { return false; }
            }
            return true;
        }



        function validateFile() {
            var flag = true;
            var fileObject = document.getElementById("inputFile");
            var errorObject = document.getElementById("error");
            var filepath = fileObject.value;
            if (filepath == undefined || filepath == "") {
                fileObject.focus();
                errorObject.innerText = "请选择上传文件！";
                flag = false;
            } else {
                var fileArr = filepath.split("\\");
                var fileTArr = fileArr[fileArr.length - 1].toLowerCase().split(".");
                var filetype = fileTArr[fileTArr.length - 1];

                filetype = filetype.toUpperCase();
                if (filetype == "JS" || filetype == "EXE" || filetype == "MSI") {
                    fileObject.focus();
                    errorObject.innerText = "上传文件不能包脚文件与执行文件！";
                    flag = false;
                } 
            }
            //进行其他相关校验 
//            if (flag) {
//                alert("文件上传成功");
//            }
        }






//        function CheckFile() {
//            debugger;
//               //上传文件不能为空，格式必须为xsl和xlsx 
//            var flag = true;
//            var fileObject = $("input[name='File']");
//            var filepath = $("input[name='File']").val();
//            if (filepath == undefined || $.trim(filepath) == "") {
//                fileObject.focus().next().text("请选择上传文件！");
//                flag = false;
//            } 
//            else
//             {
//                var fileArr = filepath.split("\\");
//                var fileTArr = fileArr[fileArr.length - 1].toLowerCase().split(".");
//                var filetype = fileTArr[fileTArr.length - 1];

//            }
//         }
  
//    $(function () {
//        $("#ButtonConfirm").click(function () {

//                 else {
//                    fileObject.next().text("");
//                 }
//            }

//            进行其他相关校验 

//            if (flag) {
//                alert("文件上传成功");
//            }
//        });
//    }); 


    </script>


    


</head>
<body >
    <form id="form1" runat="server">
      <div align="center">
         <fieldset style="width: 88%;">
            <legend><font style="font-size: 12px; color: #082c50; font-family: 宋体">附 件 信 息</font></legend>
            
            <table cellspacing="0" style="width: 97%;">
                <tr valign="top">
                    <td valign="top" align="left" width="65">
                        &nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td align="left">
                        <div id="FileCollection">
                           <input id="inputFile" type="file" size="80" name="inputFile" runat="server" />
                           
                            <asp:Button
                                ID="ButtonConfirm" Text="确认上传" Width="100px" runat="server" CausesValidation="False"
                                CssClass="btn" OnClick="ButtonConfirm_Click" ></asp:Button></div>
                        <asp:Label ID="labelUpResult" Font-Size="9pt" runat="server" Width="179px"></asp:Label><br>
                        <div style="border: solid 1px #E4E7E2; vertical-align: top; width: 522px">
                            <asp:GridView ID="gvAffixfiles" SkinID="gvList" runat="server" AutoGenerateColumns="False"
                                Width="522px">
                                <Columns>
                                    <asp:BoundField DataField="TaskInstanceCaption" HeaderText="文件ID" ReadOnly="True"
                                        Visible="false" SortExpression="TaskInstanceCaption">
                                        <HeaderStyle CssClass="gvHeader" />
                                        <ItemStyle CssClass="gvItem" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="TaskInstanceCaption" HeaderText="任务名" ReadOnly="True"
                                        SortExpression="TaskInstanceCaption">
                                        <HeaderStyle CssClass="gvHeader" />
                                        <ItemStyle CssClass="gvItem" />
                                    </asp:BoundField>
                                    <asp:TemplateField HeaderText="文件名" ShowHeader="False">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lbtnFileName" OnClick="lbtnFileName_Click" runat="server" Text='<%#Eval("FileName")%>'
                                                CausesValidation="false" CommandName='<%#Eval("FileName")%>' CommandArgument='<%#Eval("FileNameId")%>'></asp:LinkButton>
                                        </ItemTemplate>
                                        <HeaderStyle CssClass="gvHeader" />
                                        <ItemStyle CssClass="gvItem" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="操作" ShowHeader="False">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName=""
                                                OnClientClick='<%#"if(!Selected("+Eval("Status").ToString()+")){return false;}"%>'
                                                Enabled='<%#DataBinder.Eval(Container.DataItem, "Status").ToString()== "3"?false:true%>'
                                                ForeColor='<%#DataBinder.Eval(Container.DataItem, "Status").ToString()== "3"?System.Drawing.Color.Black:System.Drawing.Color.Empty%>'
                                                Text="删除" CommandArgument='<%#Eval("AffixId")+","+Eval("FilePath")%>' OnClick="LinkButton2_Click"></asp:LinkButton>
                                        </ItemTemplate>
                                        <HeaderStyle CssClass="gvHeader" />
                                        <ItemStyle CssClass="gvItem" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="下载" ShowHeader="False">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName='<%#Eval("FileName")%>'
                                                Text="下载" OnClick="LinkButton1_Click" CommandArgument='<%#Eval("FileNameId")%>'></asp:LinkButton>
                                        </ItemTemplate>
                                        <HeaderStyle CssClass="gvHeader" />
                                        <ItemStyle CssClass="gvItem" />
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                        </div>
                    </td>
                </tr>
            </table>
        </fieldset>
    </div>
    <script type="text/javascript">
        function Save() {
            parent(_WorkflowId);
        }
    </script>
    </form>
</body>
</html>
